package main

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

func main(){
	engine := gin.Default()
	//指定模板路径
	engine.LoadHTMLGlob("template/*")
	//指定静态资源
	engine.Static("/static","./static")
	engine.GET("/index", func(c *gin.Context) {

		//c.HTML()将数据提交给定前端html页面显示
		c.HTML(http.StatusOK,"index.html",gin.H{
			"name" : "张三",
			"age" : "18",
			"courses" : []string{"语文","数学","英语"},//传入切片
		})
	})
	engine.Run()
}
